import 'package:car_map/page/res/gaps.dart';
import 'package:car_map/page/res/styles.dart';
import 'package:car_map/page/routers/fluro_navigator.dart';
import 'package:car_map/page/squarepage/coffee_shop_page/widget_coffee_grider_item.dart';
import 'package:car_map/page/squarepage/coffee_shop_page/widget_coffee_swiper.dart';
import 'package:car_map/page/squarepage/coffee_shop_page/widget_tide_goods.dart';
import 'package:car_map/page/squarepage/coffee_shop_page/widget_title_classification.dart';
import 'package:car_map/widget/widget_search_textfield.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import 'widget_coffee_list_item.dart';

///咖啡店
class CoffeeShopPage extends StatefulWidget {
  @override
  coffeeShopState createState() => coffeeShopState();
}

class coffeeShopState extends State<CoffeeShopPage> {
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
      appBar: AppBar(
        leading: InkWell(
          onTap: () {
            NavigatorUtils.goBack(context);
          },
          child: Icon(
            Icons.arrow_back,
            color: Colors.black45,
          ),
        ),
        backgroundColor: Colors.white,
        title: getAppBar(),
      ),
      body: Container(
          color: Colors.white,
          padding: EdgeInsets.all(10.0),
          child: ListView(
            children: <Widget>[
              Text(
                '早上好,Flutter',
                style: TextStyles.textBold26,
              ),
              Gaps.vGap8,
              WidgetCoffeeSwiper(pathUrl: 'https://s2.luckincoffeecdn.com/luckywebrm/images/index/cooperation/part5_picture1-1.png',),
              Gaps.vGap8,
              WidgetTitleClassification(
                titleName: '新品推荐',
                moveNum: 5,
              ),
              Gaps.vGap8,
              Container(
                height: ScreenUtil().setHeight(300.0),
                child: ListView.builder(
                  itemBuilder: (context, index) {
                    return WidgetCoffeeGriderItem();
                  },
                  itemCount: 10,
                  shrinkWrap: true,
                  scrollDirection: Axis.horizontal,
                ),
              ),
              Gaps.vGap8,
              WidgetTitleClassification(
                titleName: '今日优惠',
                moveNum: 7,
              ),
              Gaps.vGap8,
              ListView.builder(
                itemBuilder: (context, index) {
                  return WidgetCoffeeListItem();
                },
                itemCount: 3,
                shrinkWrap: true,
                physics: new NeverScrollableScrollPhysics(),
              ),
              Gaps.vGap8,
              WidgetTitleClassification(
                titleName: '周边潮品',
                moveNum: 9,
              ),
              Gaps.vGap8,
              WidgetTideGoods(),
            ],
          )),
    );
  }

  //标题
  Widget getAppBar() {
    return Row(
      mainAxisAlignment: MainAxisAlignment.spaceAround,
      children: <Widget>[
        Container(
          width: ScreenUtil().setWidth(450.0),
          child: WidgetSearchTextField(),
        ),
        Row(
          children: <Widget>[
            Icon(
              Icons.add_location,
              color: Colors.black45,
            ),
            Icon(Icons.fullscreen, color: Colors.black45),
          ],
        )
      ],
    );
  }
}
